package com.itholmes.test;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import com.itholmes.ServletConfig.ServletConfig;
import com.itholmes.ServletContext.ServletContext;
import com.itholmes.bean.Result;
import com.itholmes.tomcat.MyRequest;
import com.itholmes.tomcat.MyResponse;
import com.itholmes.tomcat.MyServlet;

public class aa extends MyServlet{
	
	@Override
	public void doGet(MyRequest req, MyResponse resp) {
		
		//getAttribute的演示

		Object object = req.getAttribute("key");
		
		ServletContext context = req.getServletContext();
		Object attribute = context.getAttribute("context");

		ServletConfig servletConfig = getServletConfig();
		String initParameter = servletConfig.getInitParameter("config");

		String body = 
				"<html>\r\n" + 
				"<head>\r\n" + 
				"    <title>我的tomcat值传递</title>\r\n" + 
				"</head>\r\n" + 
				"<body>\r\n" +
				"<p>"+
				attribute.toString()+
				"</p>"+
				"</body>\r\n" + 
				"</html>";

		resp.getWrite(body);
	}
	@Override
	public void doPost(MyRequest req, MyResponse resp) {
		this.doGet(req, resp);
	}
	
}
